package com.itheima.controller;

import com.itheima.anno.Log;
import com.itheima.common.PageBean;
import com.itheima.common.R;
import com.itheima.dtos.PageCustomerDto;
import com.itheima.mapper.CustomerMapper;
import com.itheima.pojo.Customer;
import com.itheima.service.CustomerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@CrossOrigin
@RequestMapping("/customer")
public class CustomerController {
    @Autowired
    CustomerService customerService;

    //分页查询

    /**
     * 带条件的分页查询
     * @param pageCustomerDto 条件
     * @return R
     */
    @Log
    @GetMapping("/pageQuery")
    public R queryPage(PageCustomerDto pageCustomerDto){
        PageBean<Customer> maps = customerService.queryPage(pageCustomerDto);
        return R.ok(maps);
    }
}
